SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 56256: Querying a relational DBMS table using the IN clause operator might return unexpected results

DetailsHotfixAboutRate It

Typically, in a relational database management system (RDBMS), nulls represent the absence of data. That is, RDBMS nulls do not sort or compare because there is no data on which to operate. However, in SAS, there is the concept of a missing value, which is quite different.

In SAS, using the IN operator where single quotation marks (‘ ’) are used to represent a null might return unexpected results.

In the following query, SAS passes the WHERE clause as written. This prevents most databases from finding the rows where the variable A was NULL. This happens when the database does not consider a NULL as equal to any value, so rows with NULLS would not be determined to be a match:

SELECT count(b) FROM m.MISSING1 t1 WHERE t1.A in ('DATA2','');

To work around this issue, rewrite the query to something similar to the following:

SELECT count(b) FROM m.MISSING1 t1 WHERE t1.A in ('DATA2') or t1.A is null;

Click the Hot Fix tab in this note to access the hot fix for this issue.



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemBase SASz/OS9.3_M29.4_M39.3 TS1M29.4 TS1M3
Z649.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft® Windows® for x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8 Enterprise 32-bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8 Enterprise x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8 Pro 32-bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8 Pro x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Enterprise 32-bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Enterprise x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Pro9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Pro 32-bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows Server 2003 Datacenter Edition9.3_M29.3 TS1M2
Microsoft Windows Server 2003 Enterprise Edition9.3_M29.3 TS1M2
Microsoft Windows Server 2003 Standard Edition9.3_M29.3 TS1M2
Microsoft Windows Server 2003 for x649.3_M29.3 TS1M2
Microsoft Windows Server 20089.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows Server 2008 R29.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows Server 2008 for x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 Datacenter9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 R2 Datacenter9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 R2 Std9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 Std9.3_M29.4_M39.3 TS1M29.4 TS1M3
Microsoft Windows XP Professional9.3_M29.3 TS1M2
Windows 7 Enterprise 32 bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows 7 Enterprise x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows 7 Home Premium 32 bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows 7 Home Premium x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows 7 Professional 32 bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows 7 Professional x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows 7 Ultimate 32 bit9.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows 7 Ultimate x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Windows Vista9.3_M29.3 TS1M2
Windows Vista for x649.3_M29.3 TS1M2
64-bit Enabled AIX9.3_M29.4_M39.3 TS1M29.4 TS1M3
64-bit Enabled HP-UX9.3_M29.4_M39.3 TS1M29.4 TS1M3
64-bit Enabled Solaris9.3_M29.4_M39.3 TS1M29.4 TS1M3
HP-UX IPF9.3_M29.4_M39.3 TS1M29.4 TS1M3
Linux9.3_M29.4_M39.3 TS1M29.4 TS1M3
Linux for x649.3_M29.4_M39.3 TS1M29.4 TS1M3
Solaris for x649.3_M29.4_M39.3 TS1M29.4 TS1M3
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.